import WMap from '../map/index.js'

const map = new WMap.Map('map', {
	center: [116.3910920,39.9123652],
	zoom:18
})

// map.on('click', e => {
// 	map.panTo(e.lngLat)
// 	console.log(e.lngLat)
// })
const m1 = new WMap.Marker({
    icon: 'img/marker_red.png',
    position: [116.3910920,39.9123652]
  })
	map.add(m1)
const lngLat = new WMap.LngLat(116.3910920,39.9123652)

map.setCenter(lngLat,18);
const changebaidu = document.getElementById('changebaidu')
const changeamap = document.getElementById('changeamap')
const changegooglesatellite = document.getElementById('changegooglesatellite')
const changegoogleannosatellite = document.getElementById('changegoogleannosatellite')
const changetianditusatellite = document.getElementById('changetianditusatellite')
const curMapName = document.getElementById('curMapName')
curMapName.innerText = 'baidu'
//百度地图
changebaidu.onclick = () => {
	map.setBaseLayer('baidu')
	curMapName.innerText = map.getCurrentBaseLayer()[0].get('mapName')
}

//谷歌无标注影像
changegooglesatellite.onclick = () => {
	map.setBaseLayer('googlesatellite')
	curMapName.innerText = map.getCurrentBaseLayer()[0].get('mapName')
}

//谷歌带标注影像
changegoogleannosatellite.onclick = () => {
	map.setBaseLayer('googleannosatellite')
	curMapName.innerText = map.getCurrentBaseLayer()[0].get('mapName')
}

// 天地图影像 token请自行到官网申请
changetianditusatellite.onclick = () => {
	map.setBaseLayer('tianditusatellite',"5281d481de6e8ffa88add376ade28968")
	curMapName.innerText = map.getCurrentBaseLayer()[0].get('mapName')
}

// 高德地图
changeamap.onclick = () => {
	map.setBaseLayer('amap')
	curMapName.innerText = map.getCurrentBaseLayer()[0].get('mapName')
}
